import { HttpGet, HttpPost, HttpUpload } from '@/api/index.js'

/**
 * 新增
 * @param data
 */
export const add = (data) => {
    return HttpPost('/admin/erp/product/add', data)
}

/**
 * 编辑
 * @param data
 */
export const edit = (data) => {
    return HttpPost('/admin/erp/product/update', data)
}

/**
 * 根据ID删除
 * @param id
 */
export const deleteById = (id) => {
    return HttpPost('/admin/erp/product/deleteById/' + id)
}

/**
 * 分页列表
 * @param search
 */
export const pageList = (search) => {
    return HttpGet('/admin/erp/product/pageList', search)
}

/**
 * 列表
 * @param search
 */
export const list = (search) => {
    return HttpGet('/admin/erp/product/lise', search)
}

/**
 * 新增分类
 * @param data
 */
export const categoryAdd = (data) => {
    return HttpPost('/admin/erp/product/categoryAdd', data)
}

/**
 * 获取产品分类树结构
 * @param search
 */
export const treeCategory = (search) => {
    return HttpGet('/admin/erp/product/categoryTree', search)
}

/**
 * 获取分类列表
 * @param search
 */
export const categoryList = (search) => {
    return HttpGet('/admin/erp/product/categoryList', search)
}

/**
 * 更新产品分类
 * @param data
 */
export const categoryUpdate = (data) => {
    return HttpPost('/admin/erp/product/categoryUpdate', data)
}

/**
 * 根据ID删除产品分类
 * @param id
 */
export const categoryDeleteById = (id) => {
    return HttpPost('/admin/erp/product/categoryDeleteById/' + id)
}

/**
 * 新增单位
 * @param data
 */
export const unitAdd = (data) => {
    return HttpPost('/admin/erp/product/unitAdd', data)
}

/**
 * 更新单位
 * @param data
 */
export const unitEdit = (data) => {
    return HttpPost('/admin/erp/product/unitUpdate', data)
}

/**
 * 单位分页列表
 * @param search
 */
export const unitPageList = (search) => {
    return HttpGet('/admin/erp/product/unitPageList', search)
}

/**
 * 删除单位
 * @param id
 */
export const unitDeleteById = (id) => {
    return HttpPost('/admin/erp/product/unitDeleteById/' + id)
}

/**
 * 单位下拉列表
 */
export const unitSelectList = () => {
    return HttpGet('/admin/erp/product/unit/selectList')
}

/**
 * 新增品牌
 * @param data
 */
export const brandAdd = (data) => {
    return HttpPost('/admin/erp/product/brandAdd', data)
}

/**
 * 品牌图片上传
 * @param file
 */
export const brandUploadFile = (file) => {
    return HttpUpload('/admin/erp/product/brandUploadFile', file)
}

/**
 * 更新品牌
 */
export const brandEdit = (data) => {
    return HttpPost('/admin/erp/product/brandUpdate', data)
}

/**
 * 品牌分页列表
 * @param data
 */
export const brandPageList = (data) => {
    return HttpGet('/admin/erp/product/brandPageList', data)
}

/**
 * 品牌列表
 * @param data
 */
export const brandList = (data) => {
    return HttpGet('/admin/erp/product/brandList', data)
}
